package ofc4j.util;

import ofc4j.model.elements.StackedBarChart.StackValue;

import com.thoughtworks.xstream.converters.MarshallingContext;
import com.thoughtworks.xstream.io.path.PathTrackingWriter;

public class StackValueConverter extends ConverterBase<StackValue> {

    @Override
    public void convert(StackValue o, PathTrackingWriter writer, MarshallingContext mc) {
        writeNode(writer, "val", o.getValue());
        writeNode(writer, "colour", o.getColour());
    }

    @Override
    @SuppressWarnings("unchecked")
    public boolean canConvert(Class clazz) {
        return StackValue.class.isAssignableFrom(clazz);
    }
}
